package io.jsen.meta.diff.obj;

import io.jsen.meta.diff.feature.FieldControl;
import io.jsen.meta.diff.field.MetaFieldDefine;

/**
 * @author jsen
 * @date 2021/09/18
 **/
public interface Index<S> {
    /**
     * metaObject 创建索引
     *
     * @param metaFieldDefine 字段
     * @param val             值
     * @return 索引
     */
    default String proxyIndex(MetaFieldDefine metaFieldDefine, S val) {
        FieldControl fieldControl = metaFieldDefine.getFieldControl();
        return fieldControl.buildIndex(metaFieldDefine, val, this::createIndex);
    }

    String createIndex();
}
